<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('test', function () {
//    dd(1);
//});

Route::get('auth/login', 'Auth\AuthController@getLogin');

//前台路由组,访问时直接访问域名即可
Route::group(['namespace' => 'Home'], function(){
    // 控制器在 "App\Http\Controllers\Home" 命名空间下
    Route::get('/', [
        'as' => 'index', 'uses' => 'IndexController@index'
    ]);
    Route::get('login','IndexController@login');
    
    Route::get('get','RedisController@get');
    Route::get('set','RedisController@set');
    Route::any('wechat','WechatController@server'); 
    
    Route::any('broadcast','BroadCastController@broadCast');//群发消息
    
    
    Route::get('menu','MenuController@menu'); //添加菜单
    Route::get('allmenu','MenuController@getAllMenu');  //获取所有菜单
    Route::get('delmenu','MenuController@delMenu'); //删除所有菜单
    
    Route::get('users','UserController@getAllUsers'); //获取所有用户
    Route::get('user/{openid}','UserController@userDetail');//根据openid查看某个用户的详情
    Route::get('remake','UserController@remake');//给用户加备注
    
    Route::get('image','MaterialController@image');//上传图片
    Route::get('uploadthumb','MaterialController@uploadThumb');//上传缩略图
    Route::get('uploadarticle/{mediaId}','MaterialController@uploadArticle');//上传图文
    Route::get('getallimages','MaterialController@getAllImages');//获取所有的素材图片
    Route::get('updatearticle/{mediaId}','MaterialController@updateArticle');//获取所有的素材图片
    Route::get('stats','MaterialController@all');//获取所有的素材图片
    
    
    Route::get('qrcode','QrcodeController@qrcode'); //生成二维码
    Route::get('url/{ticket}','QrcodeController@qrcodeUrl'); //获取二维码内容
    
    //小程序接口
    Route::get('isuserexist','OrderController@isUserExist'); //判断用户是否存在
    Route::get('loudan','OrderController@loudan'); //查询客户订阅和漏单情况
    Route::get('allname','OrderController@nameStart'); //查询以某个字符开头的用户名
    Route::post('login','OrderController@Login'); //查询以某个字符开头的用户名
    Route::get('setvip','OrderController@setvip'); //用户开通vip
    Route::get('award', 'OrderController@winAward'); //活动页面每周前十名入库
    Route::get('gendanfail', 'OrderController@genDanFail'); //查看跟单失败原因
    Route::get('follow', 'OrderController@follow'); //用户订阅详情
    Route::get('orderinfo', 'OrderController@orderInfo'); //查看订单详情
    
    
    Route::get('gettoken', 'WxController@getWxToken'); //获取access_token
    Route::get('getopenid', 'WxController@getOpenId'); //获取openid
    
    //小程序 我的页面  
    Route::any('custominfo', 'CustomController@customInfo'); //客服消息
    Route::post('uploadfile', 'CustomController@uploadFile'); //上传文件
    Route::get('download', 'CustomController@downloadFile'); //下载文件
});

//后台路由组，访问时访问域名/admin  即访问的后台
Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function(){
    // 控制器在 "App\Http\Controllers\Admin" 命名空间下
 
    Route::get('/', [
        'as' => 'index', 'uses' => 'IndexController@index'
    ]);
 
});

Route::group(['middleware' => ['web', 'wechat.oauth']], function () {
       
});